<script type="text/javascript" src="/js/system/oss/ajaxupload.js"></script>
<script type="text/javascript" src="/js/system/oss/oss.js"></script>

<div class="m-b-md">
	
</div>
<header class="panel-heading">
	<div class="doc-buttons">
		
		<a class="btn btn-primary" id="upload">
			<i class="fa fa-plus"></i>
			&nbsp;上传文件
		</a>
		<a class="btn btn-primary" onclick="del()">
			<i class="fa fa-trash-o"></i>
			&nbsp;删除
		</a>
	</div>
</header>
<div class="table-responsive">
	<div id="paging" class="pagclass"></div>
</div>
<script type="text/javascript">
new AjaxUpload('#upload', {
    action: '/sys/oss_do/upload.do',
    name: 'file',
    autoSubmit:true,
    responseType:"json",
    onSubmit:function(file, extension){
        //if(vm.config.type == null){
       //     alert("云存储配置未配置");
        //    return false;
       // }
        if (!(extension && /^(jpg|jpeg|png|gif)$/.test(extension.toLowerCase()))){
            alert('只支持jpg、png、gif格式的图片！');
            return false;
        }
    },
    onComplete : function(file, r){
        if(r.success){
            alert(r.url);
            grid.loadData();
           // vm.reload();
        }else{
            alert(r.msg);
        }
    }
});
</script>